package kr.hkit.powerjava.chapter07.work;

public class Practice {

	private int gubun;  
	private int age; 
	private int hour;
	
	public Practice(int gubun, int age, int hour) {
		this.gubun = gubun;
		this.age = age;
		this.hour = hour;
	}  //생성자 using field 왜 필요함?
	 
/*	private void setData(int gubun, int age, int hour) {
		this.gubun = gubun;
		this.age = age;
		this.hour = hour;
	} *///setData

	
	public int getPrice(){

		int price = 0;
		if (this.gubun == 1) { //자유이용권
			if (hour > 16) {  //야간
				if (age < 3) { //영아
					price = 0;
				}else if (age < 13 || age > 64){ //소인
					price = 21000;
				}else{                           //대인
					price = 29000;
				}
			}else{ //주간
				if (age < 3) { //영아
					price = 0;
				}else if (age < 13 || age > 64){ //소인
					price = 25000;
				}else{                           //대인
					price = 34000;
				}
			}
		}else{					//입장권
			if (hour > 16) {  //야간
				if (age < 3) { //영아
					price = 0;
				}else if (age < 13 || age > 64){ //소인
					price = 17000;
				}else{                           //대인
					price = 23000;
				}
			}else{ //주간
				if (age < 3) { //영아
					price = 0;
				}else if (age < 13 || age > 64){ //소인
					price = 20000;
				}else{                           //대인
					price = 27000;
				}
			}
		}
		return price;
	}

	@Override
	public String toString() {
		return "Practice [gubun=" + gubun + ", age=" + age + ", hour=" + hour
				+ ", getPrice()=" + getPrice() + "]";
	}
}
